﻿<?xml version="1.0" encoding="utf-8" ?>
<Rules FriendlyName= "Custom Rules for VS2013">
  <Rule TypeName="ArrayIndexing" Category="Custom.Design"  CheckId="SA0037">
    <Name>Do use indexing for retrieving data from an array</Name>
    <Description>Do use indexing for retrieving data from an array</Description>
    <Url></Url>
    <Resolution>
      Use the indexers property to retrieve and assign data from an array
    </Resolution>
    <Email></Email>
    <MessageLevel Certainty="95">Warning</MessageLevel>
    <FixCategories>NonBreaking</FixCategories>
    <Owner/>
  </Rule>  
  <Rule TypeName="DefaultConstructor" Category="Custom.Design" CheckId="SA0025">
    <Name>Do not provide a default constructor</Name>
    <Description>Do not provide a default constructor. The runtime will insert a constructor that initializes all of the values to a zero state. This allows arrays of structs to be created without having to run the constructor of each instances.</Description>
    <Url></Url>
    <Resolution>Do not provide a default constructor {0}.The runtime will insert a constructor that initializes all of the values to a zero state. This allows arrays of structs to be created without having to run the constructor of each instances.</Resolution>
    <Email></Email>
    <MessageLevel Certainty="95">Warning</MessageLevel>
    <FixCategories>NonBreaking</FixCategories>
    <Owner/>
  </Rule>  
  <Rule TypeName="HungarianNotation" Category="Custom.Design" CheckId="SA0032">

    <Name>Do not use Hungarian notation</Name>

    <Description>Do not use Hungarian notation</Description>

    <Url></Url>

    <Resolution> Do not use Hungarian notation {0}.</Resolution>

    <Email></Email>

    <MessageLevel Certainty="95">Warning</MessageLevel>

    <FixCategories>NonBreaking</FixCategories>

    <Owner/>

  </Rule>    
  <Rule TypeName="NestedTypesAccessibility" Category="Custom.Design" CheckId="SA0014">
    <Name>Do not use nested types when the relationship between the inner-type and outer-type is such that member accessibility semantics are desirable between the two types </Name>
    <Description>Do not use nested types when the relationship between the inner-type and outer-type is such that member accessibility semantics are desirable between the two types</Description>
    <LongDescription>Do not use nested types when the relationship between the inner-type and outer-type is such that member accessibility semantics are desirable between the two types</LongDescription>
    <Owner/>
    <Url></Url>
    <Resolution>Do not use nested types when the relationship between the inner-type and outer-type is such that member accessibility semantics are desirable between the two types</Resolution>
    <Email></Email>
    <MessageLevel Certainty="95">Warning</MessageLevel>
    <Message Certainty="95">Warning</Message>
    <FixCategories>NonBreaking</FixCategories>
  </Rule>  
  <Rule TypeName="PrefixField" Category="Custom.Design" CheckId="SA0064">
    <Name>Do not include a prefix on a field name.</Name>
    <Description>Do not include a prefix on a field name, for example 'g_' or 's_'.</Description>
    <Owner/>
    <Url></Url>
    <Resolution>Field names should begin with names like 'sName' or 'iValue'</Resolution>
    <Email></Email>
    <MessageLevel Certainty="99">Warning</MessageLevel>
    <Message Certainty="99">Warning</Message>
    <FixCategories>NonBreaking</FixCategories>
  </Rule>
  <Rule TypeName="ImplicitCastPrecision" Category="Custom.Design" CheckId="SA0057">
    <Name>Do not lose precision in implicit casts.</Name>
    <Description>Do not lose precision in implicit casts.</Description>

    <Owner/>
    <Url></Url>
    <Resolution>Perform casting without losing precision</Resolution>
    <Email></Email>
    <MessageLevel Certainty="99">Warning</MessageLevel>
    <Message Certainty="99">Warning</Message>
    <FixCategories>NonBreaking</FixCategories>
  </Rule>
  <Rule TypeName="IndexedPropertyName" Category="Custom.Design" CheckId="SA0042">
    <Name>Do use the name Item for Indexed Property unless there is an obviously better name(for example a Chars property on String).</Name>
    <Description> Do use the name Item for Indexed Property unless there is an obviously better name(for example a Chars property on String).</Description>
    <LongDescription> Do use the name Item for Indexed Property unless there is an obviously better name(for example a Chars property on String).</LongDescription>

    <Owner/>
    <Url></Url>
    <Resolution>  Do use the name Item for Indexed Property '{0}' unless there is an obviously better name(for example a Chars property on String).</Resolution>
    <Email></Email>
    <MessageLevel Certainty="95">Warning</MessageLevel>
    <Message Certainty="95">Warning</Message>
    <FixCategories>NonBreaking</FixCategories>
  </Rule>
  <Rule TypeName="PublicNestedTypes" Category="Custom.Design" CheckId="SA0016">
    <Name>Do not use publicly exposed nested types.</Name>
    <Description>Do not use publicly exposed nested types.</Description>
    <LongDescription>Donot use publicly exposed nested types.The only exception to this is if the nested type is referenced from the containing type in non main stream scenarios such as subclassing or other advanced customization.</LongDescription>
    <Owner/>
    <Url></Url>
    <Resolution>Do not use publicly exposed nested types '{0}'</Resolution>
    <Email></Email>
    <MessageLevel Certainty="95">Warning</MessageLevel>
    <Message Certainty="95">Warning</Message>
    <FixCategories>NonBreaking</FixCategories>
  </Rule>  
  <Rule TypeName="PropertyException" Category="Custom.Design" CheckId="SA0035">
    <Name>Avoid throwing exceptions from property getters.Property getters should be simple operations and should not have any preconditions.If a getter may throw an exception,it should probably be redesigned to be a method .</Name>
    <Description>Avoid throwing exceptions from property getters.Property getters should be simple operations and should not have any preconditions.If a getter may throw an exception,it should probably be redesigned to be a method .</Description>
    <LongDescription>Avoid throwing exceptions from property getters.Property getters should be simple operations and should not have any preconditions.If a getter may throw an exception,it should probably be redesigned to be a method .</LongDescription>
    <Owner/>
    <Url></Url>
    <Resolution>Avoid throwing exceptions from property getter '{0}'.Property getters should be simple operations and should not have any preconditions.If a getter may throw an exception,it should probably be redesigned to be a method .</Resolution>
    <Email></Email>
    <MessageLevel Certainty="95">Warning</MessageLevel>
    <Message Certainty="95">Warning</Message>
    <FixCategories>NonBreaking</FixCategories>    
  </Rule>  
  <Rule TypeName="PublicConstructor" Category="Custom.Design" CheckId="SA0018">
    <Name>If a type has a public constructor, it should probably not be nested</Name>
    <Description>If a type has a public constructor, it should probably not be nested</Description>
    <Owner/>
    <Url></Url>
    <Resolution>Do not use public constructors when its a nested type</Resolution>
    <Email></Email>
    <MessageLevel Certainty="99">Warning</MessageLevel>
    <Message Certainty="99">Warning</Message>
    <FixCategories>NonBreaking</FixCategories>
  </Rule>  
  <Rule TypeName="SealedVirtual" Category="Custom.Design" CheckId="SA0021">
    <Name>Consider sealing virtual members you override from the base class.</Name>
    <Description> Consider sealing virtual members you override from the base class.</Description>
    <LongDescription>Consider sealing virtual members you override from the base class.</LongDescription>
    <Owner/>
    <Url></Url>
    <Resolution>Consider sealing virtual members you override from the base class '{0}'.As with virtual members you introduce in your class there are potential problems with the virtual members you override.</Resolution>
    <Email></Email>
    <MessageLevel Certainty="95">Warning</MessageLevel>
    <Message Certainty="95">Warning</Message>
    <FixCategories>NonBreaking</FixCategories>
  </Rule>
  <Rule TypeName="OnevalueEnum" Category="Custom.Design" CheckId="SA0031">
    <Name>Enum with one value should not be publicly exposed</Name>
    <Description> Enum with one value should not be publicly exposed </Description>
    <Url></Url>
    <Resolution>'{0}'  Enum with one value should not be publicly exposed.</Resolution>
    <Email></Email>
    <MessageLevel Certainty="95">Warning</MessageLevel>
    <FixCategories>NonBreaking</FixCategories>
    <Owner/>
  </Rule>
  <Rule TypeName="ProtectedConstructors" Category="Custom.Design" CheckId="SA0059">
    <Name>Do provide a protected constructor that can be used by types in derived class</Name>
    <Description>Do provide a protected constructor that can be used by types in derived class</Description>
    <Url></Url>
    <Resolution>'{0}' Class should have a protected constructor to be used by types in derived class.</Resolution>
    <Email></Email>
    <MessageLevel Certainty="95">Warning</MessageLevel>
    <FixCategories>NonBreaking</FixCategories>
    <Owner/>
  </Rule>
  <Rule TypeName="StaticConstants" Category="Custom.Design" CheckId="SA0028">
    <Name>Do favor using enums over static constants.</Name>
    <Description>Do favor using enums over static constants.</Description>
    <LongDescription>Do favor using enums over static constants.</LongDescription>
    <Owner/>
    <Url></Url>
    <Resolution>Do favor using enums over static constants '{0}'</Resolution>
    <Email></Email>
    <MessageLevel Certainty="95">Warning</MessageLevel>
    <Message Certainty="95">Warning</Message>
    <FixCategories>NonBreaking</FixCategories>
  </Rule>
  <Rule TypeName="PredefinedFields" Category="Custom.Design" CheckId="SA0061">
    <Name>Do use public static readonly fields for predefined objects.</Name>
    <Description>Do use public static readonly fields for predefined objects.</Description>
    <Owner/>
    <Url></Url>
    <Resolution>Do use public static readonly fields for predefined objects</Resolution>
    <Email></Email>
    <MessageLevel Certainty="95">Warning</MessageLevel>
    <Message Certainty="95">Warning</Message>
    <FixCategories>NonBreaking</FixCategories>
  </Rule>
  <Rule TypeName="ConstructorCheck" Category="Custom.Design" CheckId="SA0019">
    <Name>Do explicitly provide a constructor for each class</Name>
    <Description>Do explicitly provide a constructor for each class</Description>
    <Url></Url>
    <Resolution>Provide a constructor for class {0} even if you do not define any,and make it private such that it cannot be recreated</Resolution>
    <MessageLevel Certainty="95">Warning</MessageLevel>
    <FixCategories>NonBreaking</FixCategories>
    <Owner/>
    <Email></Email>
  </Rule>  
  <Rule TypeName="ProtectedMethod" Category="Custom.Design" CheckId="SA0024">
    <Name>Do provide protected method that offers the same functionality as the privately implemented method</Name>
    <Description>Do provide protected method that offers the same functionality as the privately implemented method if the functionality is meant to be specialized by derived classes</Description>    
    <Url></Url>
    <Resolution>The method '{0}' should be defined as Protected as its functionality is being specialized by the derived classes</Resolution>
    <Email></Email>
    <MessageLevel Certainty="95">Warning</MessageLevel>
    <FixCategories>NonBreaking</FixCategories>
    <Owner/>
   
  </Rule>
  <Rule TypeName="MethodEvent" Category="Custom.Design" CheckId="SA0045">
    <Name>Do use a protected virtual method to raise each event</Name>
    <Description>Do use a protected virtual method to raise each event</Description>
    <Url></Url>
    <Resolution>'On{0}' Method should be declared as Protected virtual to raise the event.</Resolution>
    <Email></Email>
    <MessageLevel Certainty="95">Warning</MessageLevel>
    <FixCategories>NonBreaking</FixCategories>
    <Owner/>
  </Rule>    
  <Rule TypeName="MethodFailError" Category="Custom.ErrorReporting" CheckId="SA0093">

    <Name>Do throw exception for any method failure in your application</Name>

    <Description>Do throw exception for any method failure in your application </Description>

    <Url></Url>

    <Resolution>
      Public method {0} of a managed API to report method-failure by throwing an instance of an Exception-derived type.
    </Resolution>

    <Email></Email>

    <MessageLevel Certainty="95">Warning</MessageLevel>

    <FixCategories>NonBreaking</FixCategories>

    <Owner/>

  </Rule>
  <Rule TypeName="Exceptions" Category="Custom.ErrorReporting" CheckId="SA0102">
    <Name>Exceptions should be derived from System.Exception</Name>
    <Description>Exceptions should be derived from System.Exception.</Description>
    <Owner/>
    <Url></Url>
    <Resolution>Class '{0}' must be derived from System.Exception Class</Resolution>
    <Email></Email>
    <MessageLevel Certainty="95">Warning</MessageLevel>
    <Message Certainty="95">Warning</Message>
    <FixCategories>NonBreaking</FixCategories>
  </Rule>
  <Rule TypeName="CustomException" Category="Custom.ErrorReporting" CheckId="SA0098">
    <Name>Consider using existing exceptions over creating new ones</Name>
    <Description>Consider using existing exceptions over creating new ones</Description>    
    <Owner/>
    <Url></Url>
    <Resolution>Consider using existing exceptions over creating new ones'{0}'</Resolution>
    <Email></Email>
    <MessageLevel Certainty="95">Warning</MessageLevel>
    <Message Certainty="95">Warning</Message>
    <FixCategories>NonBreaking</FixCategories>
  </Rule>
  <Rule TypeName="DontReturnArray" Category="Custom.InterfaceImplementation" CheckId="SA0073">

    <Name>Do not return arrays as the internal instances of the arrays can be changed by the calling code</Name>

    <Description>Do not retrun arrays as the internal instances of the arrays can be changed by the calling code </Description>

    <Url></Url>

    <Resolution>Method '{0}' should not return Array .</Resolution>

    <Email></Email>

    <MessageLevel Certainty="95">Warning</MessageLevel>

    <FixCategories>NonBreaking</FixCategories>

    <Owner/>
  </Rule>
  <Rule TypeName ="AvoidICloneableImplementation" Category ="Custom.InterfaceImplementation" CheckId ="SA0083">
    <Name >Avoid ICloneable Implementation</Name >
    <Description >ICloneable could be used to return either deep copy or shallow copy, and is therefore not useful</Description >
    <Url></Url >
    <Resolution > Type '{0}' Implements ICloneable, which should be avoided.</Resolution >
    <MessageLevel Certainty ="99"> Error </MessageLevel >
    <FixCategories > Breaking </FixCategories >
    <Owner/>
    <Email></Email>
  </Rule >
  <Rule TypeName="GarbageCollector" Category="Custom.InterfaceImplementation" CheckId="SA0082">
    <Name>Do not call GC.Collect method and GC.GetTotalMemory(true)</Name>
    <Description>Do not call GC.Collect method and GC.GetTotalMemory(true)</Description>
    <Url></Url>
    <Resolution>Do not call GC.Collect method and GC.GetTotalMemory(true)</Resolution>
    <Email></Email>
    <MessageLevel Certainty="90">Warning</MessageLevel>
    <FixCategories>Breaking</FixCategories>
    <Owner/>
    
  </Rule>
  <Rule TypeName="CollectionMembers" Category="Custom.InterfaceImplementation" CheckId="SA0070">
    <Name>Avoid members on your collection be virtual unless extensibility is truly required</Name>
    <Description>Avoid members on your collection be virtual unless extensibility is truly required</Description>
    <LongDescription>Avoid members on your collection be virtual unless extensibility is truly required.</LongDescription>
    <Owner/>
    <Url></Url>
    <Resolution> Avoid members on your collection be virtual unless extensibility is truly required'{0}'</Resolution>
    <Email></Email>
    <MessageLevel Certainty="95">Warning</MessageLevel>
    <Message Certainty="95">Warning</Message>
    <FixCategories>NonBreaking</FixCategories>
  </Rule>    
  <Rule TypeName="NoEmptyString" Category="Custom.MemberImplementation" CheckId="SA0092">
    <Name>Do not return an empty string</Name>
    <Description>Avoid returning an empty string.</Description>
    <Owner/>
    <Url></Url>
    <Resolution>Avoid returning an empty string.</Resolution>
    <Email></Email>
    <MessageLevel Certainty="99">Warning</MessageLevel>
    <Message Certainty="99">Warning</Message>
    <FixCategories>NonBreaking</FixCategories>
  </Rule>
  <Rule TypeName="StringMethod" Category="Custom.MemberImplementation" CheckId="SA0091">
    <Name>Do not throw exceptions from ToString</Name>
    <Description>Do not throw exceptions from ToString.</Description>
    <LongDescription>Do not throw exceptions from ToString.</LongDescription>
    <Owner/>
    <Url></Url>
    <Resolution>Do not throw exceptions from ToString method '{0}'</Resolution>
    <Email></Email>
    <MessageLevel Certainty="95">Warning</MessageLevel>
    <Message Certainty="95">Warning</Message>
    <FixCategories>NonBreaking</FixCategories>
  </Rule>  
  <Rule TypeName="GenericType" Category="Custom.Naming" CheckId="SA0006">

    <Name>Do name generic type parameters with single letters</Name>

    <Description>Do name generic type parameters with single letters</Description>

    <Url></Url>

    <Resolution>Generic type parameters should be single letters and not {0}.</Resolution>

    <Email></Email>

    <MessageLevel Certainty="95">Warning</MessageLevel>

    <FixCategories>NonBreaking</FixCategories>

    <Owner/>

  </Rule>  
  <Rule TypeName="SingleTypeParameters" Category="Custom.Naming" CheckId="SA0007">

    <Name>Consider using T as type parameter name for types with single type parameter</Name>

    <Description>Consider using T as type parameter name for types with single type parameter</Description>

    <Url></Url>

    <Resolution>Consider using T as type parameter name for types with single type parameter</Resolution>

    <Email></Email>

    <MessageLevel Certainty="90">Warning</MessageLevel>

    <FixCategories>NonBreaking</FixCategories>

    <Owner/>

  </Rule>
  <Rule TypeName="NamespaceNaming" Category="Custom.Naming" CheckId="SA0005">

    <Name>Do not introduce generic type names such as 'Element','Node','Log',Message' in Namespace  names</Name>

    <Description>Do not introduce generic type names such as 'Element','Node','Log',Message' in Namespace  names.</Description>

    <Url></Url>

    <Resolution>'{0}' NameSpace violates the naming rules.</Resolution>

    <Email></Email>

    <MessageLevel Certainty="95">Warning</MessageLevel>

    <FixCategories>NonBreaking</FixCategories>

    <Owner/>

  </Rule>
  <Rule TypeName="PascalEnumName" Category="Custom.Naming" CheckId="SA0008">
    <Name>Do use Pascal casing for an enum value name </Name>
    <Description>Do use Pascal casing for an enum value name. Eg 'PascalCasing'</Description>
    <Owner/>
    <Url></Url>
    <Resolution>
      Valid Pascal names should be like '_TextBox','TextBox'.
      Invalid Pascal names are 'textbox', 'TEXTBOX', '_textbox'
    </Resolution>
    <Email></Email>
    <MessageLevel Certainty="99">Warning</MessageLevel>
    <Message Certainty="99">Warning</Message>
    <FixCategories>NonBreaking</FixCategories>
  </Rule>      
</Rules>
